package com.ruoyi.system.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.ruoyi.common.core.domain.PageQuery;
import com.ruoyi.common.core.domain.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.WmsInventoryCheck;
import com.ruoyi.system.service.IWmsInventoryCheckService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 盘库信息Controller
 *
 * @author ruoyi
 * @date 2025-07-01
 */
@RestController
@RequestMapping("/system/wmsInventoryCheck")
public class WmsInventoryCheckController extends BaseController
{
    @Autowired
    private IWmsInventoryCheckService wmsInventoryCheckService;

    /**
     * 查询盘库信息列表
     */
    @SaCheckPermission("system:wmsInventoryCheck:list")
    @GetMapping("/list")
    public TableDataInfo<WmsInventoryCheck> list(WmsInventoryCheck wmsInventoryCheck, PageQuery pageQuery)
    {
        return wmsInventoryCheckService.selectWmsInventoryCheckList(wmsInventoryCheck,pageQuery);
    }

    /**
     * 导出盘库信息列表
     */
    /*@SaCheckPermission("system:wmsInventoryCheck:export")
    @Log(title = "盘库信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, WmsInventoryCheck wmsInventoryCheck)
    {
        List<WmsInventoryCheck> list = wmsInventoryCheckService.selectWmsInventoryCheckList(wmsInventoryCheck);
        ExcelUtil<WmsInventoryCheck> util = new ExcelUtil<WmsInventoryCheck>(WmsInventoryCheck.class);
        util.exportExcel(response, list, "盘库信息数据");
    }*/

    /**
     * 获取盘库信息详细信息
     */
    @SaCheckPermission("system:wmsInventoryCheck:query")
    @GetMapping(value = "/{id}")
    public R<WmsInventoryCheck> getInfo(@PathVariable("id") Long id)
    {
        return R.ok(wmsInventoryCheckService.selectWmsInventoryCheckById(id));
    }

    /**
     * 新增盘库信息
     */
    @SaCheckPermission("system:wmsInventoryCheck:add")
    @Log(title = "盘库信息", businessType = BusinessType.INSERT)
    @PostMapping
    public R<Void> add(@RequestBody WmsInventoryCheck wmsInventoryCheck)
    {
        return toAjax(wmsInventoryCheckService.insertWmsInventoryCheck(wmsInventoryCheck));
    }

    /**
     * 修改盘库信息
     */
    @SaCheckPermission("system:wmsInventoryCheck:edit")
    @Log(title = "盘库信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public R<Void> edit(@RequestBody WmsInventoryCheck wmsInventoryCheck)
    {
        return toAjax(wmsInventoryCheckService.updateWmsInventoryCheck(wmsInventoryCheck));
    }

    /**
     * 删除盘库信息
     */
    @SaCheckPermission("system:wmsInventoryCheck:remove")
    @Log(title = "盘库信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public R<Void> remove(@PathVariable Long[] ids)
    {
        return toAjax(wmsInventoryCheckService.deleteWmsInventoryCheckByIds(ids));
    }

    /**
     * 作废盘库信息
     */
    @SaCheckPermission("system:wmsInventoryCheck:edit")
    @Log(title = "盘库信息", businessType = BusinessType.UPDATE)
	@PutMapping("/cancellation")
    public R<Void> cancellation(@RequestParam Long id)
    {
        return toAjax(wmsInventoryCheckService.cancellation(id));
    }

    /**
     * 获取盘库单号
     */
    @SaCheckPermission("system:wmsInventoryCheck:query")
    @GetMapping(value = "/getInventoryCheckOrderNo")
    public R<WmsInventoryCheck> getInventoryCheckOrderNo()
    {
        return R.ok(wmsInventoryCheckService.getInventoryCheckOrderNo());
    }
}
